package fucai.com.fucai.task;

import android.content.Context;
import android.os.Handler;

import java.util.ArrayList;
import java.util.List;

import fucai.com.fucai.blmanager.DataManager;
import fucai.com.fucai.db.FuCaiNumber;
import fucai.com.fucai.db.SixThereCom;
import fucai.com.fucai.ui.NiuFuCai;

/**
 * Created by itte on 2015/12/11.
 */
public class AddTxtToxUtilsThread extends Thread {
    private Context context;
    private Handler handler;
    private DataManager mDataManager = null;
    private List<FuCaiNumber> mFucaiNumber = new ArrayList<>();
    private List<SixThereCom> six = new ArrayList<>();
    public AddTxtToxUtilsThread(Context context, Handler handler, List<FuCaiNumber> mFucaiNumber, List<SixThereCom> six) {
        this.handler = handler;
        this.context = context;
        this.six = six;
        mDataManager = new DataManager(context);
        this.mFucaiNumber = mFucaiNumber;
    }  public AddTxtToxUtilsThread(Context context, Handler handler, List<FuCaiNumber> mFucaiNumber) {
        this.handler = handler;
        this.context = context;
        mDataManager = new DataManager(context);
        this.mFucaiNumber = mFucaiNumber;
    }

    @Override
    public void run() {
        super.run();
        handler.post(new Runnable() {
            @Override
            public void run() {
                if (null != handler) {
                    mDataManager.addListToDB(mFucaiNumber,six);
                    handler.sendMessage(handler.obtainMessage(NiuFuCai.COPY_IS_OK_LIST, "不会呀"));
                }
            }
        });
    }
}
